{% extends "base.html" %}
{% block header %}编辑客户{% endblock %}
{% block content %}
<div class="row justify-content-center">
    <div class="">
        <div class="card shadow-sm rounded p-4">
            <h4 class="mb-3">编辑客户</h4>
            <form method="post">
                {% csrf_token %}
                <div class="mb-3">
                    <label for="username" class="form-label">用户名</label>
                    <input type="text" class="form-control" id="username" name="username" value="{{ customer.username }}" required>
                </div>
                <div class="mb-3">
                    <label for="company_name" class="form-label">公司名</label>
                    <input type="text" class="form-control" id="company_name" name="company_name" value="{{ customer.company_name }}" required>
                </div>
                <div class="mb-3">
                    <label for="phone" class="form-label">手机号</label>
                    <input type="text" class="form-control" id="phone" name="phone" value="{{ customer.phone }}" >
                </div>
                <div class="mb-3">
                    <label for="address" class="form-label">公司地址</label>
                    <input type="text" class="form-control" id="address" name="address" value="{{ customer.address }}" >
                </div>
                <div class="mb-3">
                    <label for="email" class="form-label">邮箱</label>
                    <input type="email" class="form-control" id="email" name="email" value="{{ customer.email }}" >
                </div>
                <div class="mb-3">
                    <label for="remark" class="form-label">备注</label>
                    <input type="text" class="form-control" id="remark" name="remark" value="{{ customer.remark }}">
                </div>
                <hr>
                <div class="mb-3">
                    <label for="receiver" class="form-label">收件人</label>
                    <input type="text" class="form-control" id="receiver" name="receiver" value="{% if address %}{{ address.receiver }}{% endif %}">
                </div>
                <div class="mb-3">
                    <label for="delivery_phone" class="form-label">联系电话</label>
                    <input type="text" class="form-control" id="delivery_phone" name="delivery_phone" value="{% if address %}{{ address.phone }}{% endif %}">
                </div>
                <div class="mb-3">
                    <label for="delivery_address" class="form-label">收货地址</label>
                    <input type="text" class="form-control" id="delivery_address" name="delivery_address" value="{% if address %}{{ address.address }}{% endif %}">
                </div>
                <button type="submit" class="btn btn-primary">保存</button>
                <a href="/customer/" class="btn btn-secondary">返回</a>
            </form>
        </div>
    </div>
</div>
{% endblock %}
